package com.blue.wechat.invoke;

import com.blue.core.dict.HttpMethod;

/**
 * 微信接口
 * 
 * @author zhengj
 * @since 1.0 2017年1月25日
 */
public enum WechatInvoker
{
	ACCESS_TOKEN("授权", HttpMethod.GET, "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}"),
	JS_API_TICKET("js-sdk-ticket", HttpMethod.GET, "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={0}&type=jsapi"),
	
	OAUTH_REDIRECT("网页授权跳转", HttpMethod.GET, "https://open.weixin.qq.com/connect/oauth2/authorize?appid={0}&redirect_uri={1}&response_type=code&scope=snsapi_userinfo&state={2}#wechat_redirect"),
	OAUTH_ACCESS_TOKEN("网页授权", HttpMethod.GET, "https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code"),
	OAUTH_USER_INFO("网页授权获取用户信息", HttpMethod.GET, "https://api.weixin.qq.com/sns/userinfo?access_token={0}&openid={1}&lang=zh_CN"),
	
	CREATE_MENU("创建菜单", HttpMethod.POST, "https://api.weixin.qq.com/cgi-bin/menu/create?access_token={0}"),
	DELETE_MENU("删除菜单", HttpMethod.GET, "https://api.weixin.qq.com/cgi-bin/menu/delete?access_token={0}"),
	GET_MENU("获取菜单", HttpMethod.GET, "https://api.weixin.qq.com/cgi-bin/menu/get?access_token={0}"),

	GET_USER_INFO("获取用户信息", HttpMethod.GET, "https://api.weixin.qq.com/cgi-bin/user/info?access_token={0}&openid={1}&lang=zh_CN"),

	ADD_CUSTOM_ACCOUNT("添加客服帐号", HttpMethod.POST, "https://api.weixin.qq.com/customservice/kfaccount/add?access_token={0}"),
	UPDATE_CUSTOM_ACCOUNT("修改客服帐号", HttpMethod.POST, "https://api.weixin.qq.com/customservice/kfaccount/update?access_token={0}"),
	DELETE_CUSTOM_ACCOUNT("删除客服帐号", HttpMethod.POST, "https://api.weixin.qq.com/customservice/kfaccount/del?access_token={0}"),
	UPLOAD_CUSTOM_ACCOUNT_IMG("上传客服帐号头像", HttpMethod.POST, "http://api.weixin.qq.com/customservice/kfaccount/uploadheadimg?access_token={0}&kf_account={1}"),
	GET_CUSTOM_ACCOUNT("获取所有客服帐号", HttpMethod.GET, "https://api.weixin.qq.com/cgi-bin/customservice/getkflist?access_token={0}"),
	
	SEND_CUSTOM("发送客服消息", HttpMethod.POST, "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={0}"),
	
	TEMPLATE_MESSAGE("模板消息", HttpMethod.POST, "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={0}"),
	CUSTOM_MESSAGE("客服消息", HttpMethod.POST, "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={0}"),
	
	UPLOAD_MEDIA("上传临时素材", HttpMethod.POST, "https://api.weixin.qq.com/cgi-bin/media/upload?access_token={0}&type={1}"),
	GET_MEDIA("获取临时素材", HttpMethod.GET, "https://api.weixin.qq.com/cgi-bin/media/get?access_token={0}&media_id={1}"),
	ADD_MEDIA_IMAGE("新增图文素材的图片", HttpMethod.POST, "https://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token={0}"),
	
	ADD_MATERIAL_NEWS("新增永久图文素材", HttpMethod.POST, "https://api.weixin.qq.com/cgi-bin/material/add_news?access_token={0}"),
	ADD_MATERIAL("新增永久素材", HttpMethod.POST, "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token={0}&type={1}"),
	GET_MATERIAL("获取永久素材", HttpMethod.POST, "https://api.weixin.qq.com/cgi-bin/material/get_material?access_token={0}"),
	DELETE_MATERIAL("删除永久素材", HttpMethod.POST, "https://api.weixin.qq.com/cgi-bin/material/del_material?access_token={0}"),
	GET_MATERIAL_COUNT("获取永久素材总数", HttpMethod.GET, "https://api.weixin.qq.com/cgi-bin/material/get_materialcount?access_token={0}"),
	LIST_MATERIAL("获取永久素材列表", HttpMethod.POST, "https://api.weixin.qq.com/cgi-bin/material/batchget_material?access_token={0}"),
	
	GET_SHORT_URL("长链接转短链接", HttpMethod.POST, "https://api.weixin.qq.com/cgi-bin/shorturl?access_token={0}");

	private String name;
	private HttpMethod method;
	private String url;

	WechatInvoker(String name, HttpMethod method, String url)
	{
		this.name = name;
		this.method = method;
		this.url = url;
	}

	public String getName()
	{
		return name;
	}

	public HttpMethod getMethod()
	{
		return method;
	}

	public String getUrl()
	{
		return url;
	}

}
